#include "enemyattack3.h"
#include "config.h"

enemyattack3::enemyattack3()
{
    //加载光波资源
    m_enemyattack3.load(ENEMY3_ATTACK_PATH);

    //光波位置
    m_X=GAME_WIDTH;
    m_Y=0;

    //光波状态
    m_Free=true;

    //光波速度
    m_speed=ENEMY_ATTACK_SPEED;

    //光波边框
    m_Rect.setWidth(m_enemyattack3.width());
    m_Rect.setHeight(m_enemyattack3.height());
    m_Rect.moveTo(m_X,m_Y);
}
void enemyattack3::updatePosition()
{
    //空闲光波不计算坐标
    if(m_Free)
        return;
    //不空闲的光波向左移动
    m_X-=m_speed;
    m_Rect.moveTo(m_X,m_Y);
    //光波到左边界
    if(m_X<=-m_Rect.width())
    {
        m_Free=true;//重置空闲状态
    }
}
